<template>
  <ListRefreshLoad :options="pageSearchOptions"/>
</template>

<script lang="ts">
import {defineComponent} from "vue";
import ListRefreshLoad from "../ListRefreshLoad.vue";
import QianzhikongCard from "./QianzhikongCard.vue";
import {ElMessage} from "element-plus";

const pageData = [
  {
    "serialNumber": "H20250102001",
    "consultationTypeStr": "临床会诊",
    "applyHospitalName": "云南省楚雄州牟定县人民医院",
    "applyInstitutionName": "云南省楚雄州牟定县人民医院",
    "applyDate": "2025-01-02 09:27",
    "consultationWayStr": "专家会诊",
    "ensureTimeAndAddress": "",
    "patientName": "刘应翠",
    "approveProcess": "前质控",
    "approveProcessStr": "<span class='approveProcessStr'>前质控</span>",
    "applyInstitutionNameTag": "白玉兰",
    "serverHospAndDeptAndDocStr": "上海交通大学医学院附属仁济医院 / 外科 / 神经外科",
    "emergency": "否",
  },
  {
    "serialNumber": "H20250102001",
    "consultationTypeStr": "临床会诊",
    "applyHospitalName": "云南省楚雄州牟定县人民医院",
    "applyInstitutionName": "云南省楚雄州牟定县人民医院",
    "applyDate": "2025-01-02 09:27",
    "consultationWayStr": "专家会诊",
    "ensureTimeAndAddress": "",
    "patientName": "刘应翠",
    "approveProcess": "前质控",
    "approveProcessStr": "<span class='approveProcessStr'>前质控</span>",
    "applyInstitutionNameTag": "白玉兰",
    "serverHospAndDeptAndDocStr": "上海交通大学医学院附属仁济医院 / 外科 / 神经外科",
    "emergency": "否",
  },
  {
    "serialNumber": "H20250102001",
    "consultationTypeStr": "临床会诊",
    "applyHospitalName": "云南省楚雄州牟定县人民医院",
    "applyInstitutionName": "云南省楚雄州牟定县人民医院",
    "applyDate": "2025-01-02 09:27",
    "consultationWayStr": "专家会诊",
    "ensureTimeAndAddress": "",
    "patientName": "刘应翠",
    "approveProcess": "前质控",
    "approveProcessStr": "<span class='approveProcessStr'>前质控</span>",
    "applyInstitutionNameTag": "白玉兰",
    "serverHospAndDeptAndDocStr": "上海交通大学医学院附属仁济医院 / 外科 / 神经外科",
    "emergency": "否",
  },
  {
    "serialNumber": "H20250102001",
    "consultationTypeStr": "临床会诊",
    "applyHospitalName": "云南省楚雄州牟定县人民医院",
    "applyInstitutionName": "云南省楚雄州牟定县人民医院",
    "applyDate": "2025-01-02 09:27",
    "consultationWayStr": "专家会诊",
    "ensureTimeAndAddress": "",
    "patientName": "刘应翠",
    "approveProcess": "前质控",
    "approveProcessStr": "<span class='approveProcessStr'>前质控</span>",
    "applyInstitutionNameTag": "白玉兰",
    "serverHospAndDeptAndDocStr": "上海交通大学医学院附属仁济医院 / 外科 / 神经外科",
    "emergency": "否",
  },
  {
    "serialNumber": "H20250102001",
    "consultationTypeStr": "临床会诊",
    "applyHospitalName": "云南省楚雄州牟定县人民医院",
    "applyInstitutionName": "云南省楚雄州牟定县人民医院",
    "applyDate": "2025-01-02 09:27",
    "consultationWayStr": "专家会诊",
    "ensureTimeAndAddress": "",
    "patientName": "刘应翠",
    "approveProcess": "前质控",
    "approveProcessStr": "<span class='approveProcessStr'>前质控</span>",
    "applyInstitutionNameTag": "白玉兰",
    "serverHospAndDeptAndDocStr": "上海交通大学医学院附属仁济医院 / 外科 / 神经外科",
    "emergency": "否",
  },
  {
    "serialNumber": "H20250102001",
    "consultationTypeStr": "临床会诊",
    "applyHospitalName": "云南省楚雄州牟定县人民医院",
    "applyInstitutionName": "云南省楚雄州牟定县人民医院",
    "applyDate": "2025-01-02 09:27",
    "consultationWayStr": "专家会诊",
    "ensureTimeAndAddress": "",
    "patientName": "刘应翠",
    "approveProcess": "前质控",
    "approveProcessStr": "<span class='approveProcessStr'>前质控</span>",
    "applyInstitutionNameTag": "白玉兰",
    "serverHospAndDeptAndDocStr": "上海交通大学医学院附属仁济医院 / 外科 / 神经外科",
    "emergency": "否",
  },
  {
    "serialNumber": "H20250102001",
    "consultationTypeStr": "临床会诊",
    "applyHospitalName": "云南省楚雄州牟定县人民医院",
    "applyInstitutionName": "云南省楚雄州牟定县人民医院",
    "applyDate": "2025-01-02 09:27",
    "consultationWayStr": "专家会诊",
    "ensureTimeAndAddress": "",
    "patientName": "刘应翠",
    "approveProcess": "前质控",
    "approveProcessStr": "<span class='approveProcessStr'>前质控</span>",
    "applyInstitutionNameTag": "白玉兰",
    "serverHospAndDeptAndDocStr": "上海交通大学医学院附属仁济医院 / 外科 / 神经外科",
    "emergency": "否",
  },
  {
    "serialNumber": "H20250102001",
    "consultationTypeStr": "临床会诊",
    "applyHospitalName": "云南省楚雄州牟定县人民医院",
    "applyInstitutionName": "云南省楚雄州牟定县人民医院",
    "applyDate": "2025-01-02 09:27",
    "consultationWayStr": "专家会诊",
    "ensureTimeAndAddress": "",
    "patientName": "刘应翠",
    "approveProcess": "前质控",
    "approveProcessStr": "<span class='approveProcessStr'>前质控</span>",
    "applyInstitutionNameTag": "白玉兰",
    "serverHospAndDeptAndDocStr": "上海交通大学医学院附属仁济医院 / 外科 / 神经外科",
    "emergency": "否",
  },
  {
    "serialNumber": "H20250102001",
    "consultationTypeStr": "临床会诊",
    "applyHospitalName": "云南省楚雄州牟定县人民医院",
    "applyInstitutionName": "云南省楚雄州牟定县人民医院",
    "applyDate": "2025-01-02 09:27",
    "consultationWayStr": "专家会诊",
    "ensureTimeAndAddress": "",
    "patientName": "刘应翠",
    "approveProcess": "前质控",
    "approveProcessStr": "<span class='approveProcessStr'>前质控</span>",
    "applyInstitutionNameTag": "白玉兰",
    "serverHospAndDeptAndDocStr": "上海交通大学医学院附属仁济医院 / 外科 / 神经外科",
    "emergency": "否",
  },
  {
    "serialNumber": "H20250102001",
    "consultationTypeStr": "临床会诊",
    "applyHospitalName": "云南省楚雄州牟定县人民医院",
    "applyInstitutionName": "云南省楚雄州牟定县人民医院",
    "applyDate": "2025-01-02 09:27",
    "consultationWayStr": "专家会诊",
    "ensureTimeAndAddress": "",
    "patientName": "刘应翠",
    "approveProcess": "前质控",
    "approveProcessStr": "<span class='approveProcessStr'>前质控</span>",
    "applyInstitutionNameTag": "白玉兰",
    "serverHospAndDeptAndDocStr": "上海交通大学医学院附属仁济医院 / 外科 / 神经外科",
    "emergency": "否",
  },
  {
    "serialNumber": "H20250102001",
    "consultationTypeStr": "临床会诊",
    "applyHospitalName": "云南省楚雄州牟定县人民医院",
    "applyInstitutionName": "云南省楚雄州牟定县人民医院",
    "applyDate": "2025-01-02 09:27",
    "consultationWayStr": "专家会诊",
    "ensureTimeAndAddress": "",
    "patientName": "刘应翠",
    "approveProcess": "前质控",
    "approveProcessStr": "<span class='approveProcessStr'>前质控</span>",
    "applyInstitutionNameTag": "白玉兰",
    "serverHospAndDeptAndDocStr": "上海交通大学医学院附属仁济医院 / 外科 / 神经外科",
    "emergency": "否",
  },
  {
    "serialNumber": "H20250102001",
    "consultationTypeStr": "临床会诊",
    "applyHospitalName": "云南省楚雄州牟定县人民医院",
    "applyInstitutionName": "云南省楚雄州牟定县人民医院",
    "applyDate": "2025-01-02 09:27",
    "consultationWayStr": "专家会诊",
    "ensureTimeAndAddress": "",
    "patientName": "刘应翠",
    "approveProcess": "前质控",
    "approveProcessStr": "<span class='approveProcessStr'>前质控</span>",
    "applyInstitutionNameTag": "白玉兰",
    "serverHospAndDeptAndDocStr": "上海交通大学医学院附属仁济医院 / 外科 / 神经外科",
    "emergency": "否",
  },
  {
    "serialNumber": "H20250102001",
    "consultationTypeStr": "临床会诊",
    "applyHospitalName": "云南省楚雄州牟定县人民医院",
    "applyInstitutionName": "云南省楚雄州牟定县人民医院",
    "applyDate": "2025-01-02 09:27",
    "consultationWayStr": "专家会诊",
    "ensureTimeAndAddress": "",
    "patientName": "刘应翠",
    "approveProcess": "前质控",
    "approveProcessStr": "<span class='approveProcessStr'>前质控</span>",
    "applyInstitutionNameTag": "白玉兰",
    "serverHospAndDeptAndDocStr": "上海交通大学医学院附属仁济医院 / 外科 / 神经外科",
    "emergency": "否",
  },
  {
    "serialNumber": "H20250102001",
    "consultationTypeStr": "临床会诊",
    "applyHospitalName": "云南省楚雄州牟定县人民医院",
    "applyInstitutionName": "云南省楚雄州牟定县人民医院",
    "applyDate": "2025-01-02 09:27",
    "consultationWayStr": "专家会诊",
    "ensureTimeAndAddress": "",
    "patientName": "刘应翠",
    "approveProcess": "前质控",
    "approveProcessStr": "<span class='approveProcessStr'>前质控</span>",
    "applyInstitutionNameTag": "白玉兰",
    "serverHospAndDeptAndDocStr": "上海交通大学医学院附属仁济医院 / 外科 / 神经外科",
    "emergency": "否",
  },
  {
    "serialNumber": "H20250102001",
    "consultationTypeStr": "临床会诊",
    "applyHospitalName": "云南省楚雄州牟定县人民医院",
    "applyInstitutionName": "云南省楚雄州牟定县人民医院",
    "applyDate": "2025-01-02 09:27",
    "consultationWayStr": "专家会诊",
    "ensureTimeAndAddress": "",
    "patientName": "刘应翠",
    "approveProcess": "前质控",
    "approveProcessStr": "<span class='approveProcessStr'>前质控</span>",
    "applyInstitutionNameTag": "白玉兰",
    "serverHospAndDeptAndDocStr": "上海交通大学医学院附属仁济医院 / 外科 / 神经外科",
    "emergency": "否",
  },
  {
    "serialNumber": "H20250102001",
    "consultationTypeStr": "临床会诊",
    "applyHospitalName": "云南省楚雄州牟定县人民医院",
    "applyInstitutionName": "云南省楚雄州牟定县人民医院",
    "applyDate": "2025-01-02 09:27",
    "consultationWayStr": "专家会诊",
    "ensureTimeAndAddress": "",
    "patientName": "刘应翠",
    "approveProcess": "前质控",
    "approveProcessStr": "<span class='approveProcessStr'>前质控</span>",
    "applyInstitutionNameTag": "白玉兰",
    "serverHospAndDeptAndDocStr": "上海交通大学医学院附属仁济医院 / 外科 / 神经外科",
    "emergency": "否",
  },
];

export default defineComponent({
  name: "Qianzhikong",
  components: {ListRefreshLoad},
  props: {},
  data() {
    return {};
  },
  computed: {
    pageSearchOptions() {
      return {
        dataConfig: {
          paginationCurrentPageKey: "currPage",
        },
        pagination: {
          pageSize: 5,
        },
        request(params) {
          ElMessage({
            message: '请求操作，参数请看控制台打印',
            type: 'success',
          });
          console.log('请求操作参数', params);

          const paramsData = {
            ...params,
            page: params.currentPage,
            rows: params.pageSize,
          };

          function getPageData(params) {
            if (params.pageSize >= pageData.length) {
              return pageData;
            }

            let startIndex = (params.currentPage - 1) * params.pageSize;
            let endIndex = startIndex + params.pageSize;
            if (endIndex >= pageData.length) {
              return pageData.slice(startIndex, pageData.length);
            }

            return pageData.slice(startIndex, endIndex);
          }

          console.log(getPageData(params))

          return {
            total: 16,
            currentPage: params.currentPage,
            pageSize: params.pageSize,
            rows: getPageData(params),
          };
        },
        searchKeyword: {
          prop: "patientName",
          attribute: {
            placeholder: "患者姓名查询",
          },
        },
        searchSiftItems: [
          {
            prop: "consultationType",
            title: "会诊类型",
            siftItems: [
              {label: "临床会诊", value: "clinical"},
              {label: "影像会诊", value: "image"},
              {label: "心电会诊", value: "ecg"},
              {label: "病理会诊", value: "pathology"},
            ],
            isMultiple: false,
          },
          {
            prop: "approveProcessStr",
            title: "会诊状态",
            siftItems: [
              {label: "待提交", value: "wait_submit"},
              {label: "申请端质控", value: "apply_quality_control"},
              {label: "前质控", value: "server_quality_control"},
              {label: "分诊", value: "diagnosis"},
              {label: "会诊中心分诊", value: "diagnosis_center"},
              {label: "会诊科室分诊", value: "diagnosis_organization"},
              {label: "会诊专家确认", value: "diagnosis_doctor_ensure"},
              {label: "会诊中心确认", value: "diagnosis_center_ensure"},
              {label: "会诊", value: "consultation"},
              {label: "后质控", value: "report_quality_control"},
              {label: "发布", value: "publish"},
              {label: "已取消", value: "cancel"},
              {label: "已完成", value: "success"},
              {label: "退回", value: "refuse"},
            ],
            isMultiple: true,
          },
          {
            prop: "applyInstitutionNameTag",
            title: "会诊来源",
            siftItems: [
              {label: "白玉兰", value: "byl"},
              {label: "第三方", value: "third"},
            ],
            isMultiple: false,
          },
        ],
        listItemCmptName: QianzhikongCard,
      };
    },
  },
});
</script>

<style scoped lang="scss"></style>
